#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
飞书授权示例
演示如何使用授权助手获取授权码
"""

import sys
import os

# 添加src目录到Python路径
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))

try:
    from feishu_auth_helper import (
        open_feishu_auth_page,
    )
except ImportError as e:
    print(f"❌ 导入失败: {e}")
    print("请确保在项目根目录运行此脚本")
    sys.exit(1)
 
def main():
    """
    主函数
    """
    try:
       open_feishu_auth_page()
    except KeyboardInterrupt:
        print("\n\n👋 程序已退出")
    except Exception as e:
        print(f"\n❌ 程序错误: {e}")
        print("请检查配置文件是否正确")


if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        print("\n\n👋 程序已退出")
    except Exception as e:
        print(f"\n❌ 程序启动失败: {e}")
        print("请确保:")
        print("1. 在项目根目录运行此脚本")
        print("2. 配置文件存在且正确")
        print("3. 已安装所需依赖")